20230322
[shlib.git] / testing / 5.shlib_v0_3_testing.Testing for shlib v0_3.unit / 2.strfmt_testing.strfmt and strdispatch Testing.unit / 11.sample2tmpl_testing.sh.Testing generating tmpl from sample text.txt
blob8dbb6dcb89c558378ad671c7b528039133f9344f
1 =================================
2 = include lib path testing.
3 =================================
4 \e[36m\e[1m= if this string is displayed on screen,\e[0m
5 \e[36m\e[1m= that means shlib of stdio.shlib is included by 'include' cmd.\e[0m
6 SHLIB_LIST=
7 SHLIB_INC_LIST=
8 //usr/shlib/stdio.shlib
9 //usr/shlib/dbgout.shlib
10 //usr/shlib/term.shlib
11 =================================
12 \e[36m\e[1m= different shlib path append testing.\e[0m
13 =================================
14 \e[45m\e[1mappend shlib path manully by var assignment.\e[0m
15 =================================
16 \e[36m\e[1m= current shlib paths:\e[0m
17 //usr/shlib
18 //usr/libexec/dvar/shlib
19 \e[36m\e[1m= create lib path dir '~/.testing/shlib1',\e[0m
20 \e[36m\e[1m= and append it to SHLIB_PATH by var assignment.\e[0m
21 \e[36m\e[1m= current shlib paths:\e[0m
22 //usr/shlib
23 //usr/libexec/dvar/shlib
24 ~/.testing/shlib1
25 \e[36m\e[1m= copy example.shlib to new dest shlib1 which is appended just now.\e[0m
26 scripts/example.shlib => ~/.testing/shlib1
27 \e[36m\e[1m= try to 'source' example.shlib.\e[0m
28 load example.shlib at the beginning ...
29 err: file uniq.shlib can not be found in //usr/shlib://usr/libexec/dvar/shlib:~/.testing/shlib1
30 load example.shlib at the tail ...
31 file ~/.testing/shlib1/example.shlib is sourced
32 \e[36m\e[1m= invoke function in example.shlib, and it would works.\e[0m
33 example_func() is invoked in example.shlib.
34 \e[36m\e[1m= this step report an error, because there is no uniq.shlib in shlib path now.\e[0m
35 \e[36m\e[1m= the problem is used for next step testing.\e[0m
36 \e[36m\e[1m= unset function in example.shlib, and it would NOT works.\e[0m
37 ./1.file_inc_path_testing.sh: line 121: example_func: command not found
38 \e[36m\e[1m= delete include path we append by var assignment just now.\e[0m
39 \e[36m\e[1m= the paramter of del_shlib_path must add a quoate to path string.\e[0m
40 //usr/shlib
41 //usr/libexec/dvar/shlib
42 ~/.testing/shlib1
43 \e[36m\e[1m= current shlib paths:\e[0m
44 //usr/shlib
45 //usr/libexec/dvar/shlib
47 \e[36m\e[1m= it restore to the environment before append include path manually.\e[0m
48 =================================
49 = 1.\e[45m\e[1minc path get/set/del.\e[0m
50 =================================
51 \e[36m\e[1m= now, we will test include and include path appending again by cmds which is provided by shlib.\e[0m
52 \e[36m\e[1m= create and add path '~/.testing/shlib2' to shlib include paths.\e[0m
53 \e[36m\e[1m= current shlib paths:\e[0m
54 //usr/shlib
55 //usr/libexec/dvar/shlib
56 ~/.testing/shlib2
57 =================================
58 = 2.\e[45m\e[1minc shlib in lib-path.\e[0m
59 =================================
60 \e[36m\e[1m= copy example.shlib to new dest shlib2.\e[0m
61 scripts/example.shlib => ~/.testing/shlib2
62 \e[36m\e[1m= try to include example.shlib.\e[0m
63 load example.shlib at the beginning ...
64 err: file uniq.shlib can not be found in //usr/shlib://usr/libexec/dvar/shlib:~/.testing/shlib2
65 load example.shlib at the tail ...
66 \e[36m\e[1m= invoke function in example.shlib, and it would works.\e[0m
67 example_func() is invoked in example.shlib.
68 \e[36m\e[1m= unset function in example.shlib, and it would NOT works.\e[0m
69 ./1.file_inc_path_testing.sh: line 155: example_func: command not found
70 \e[36m\e[1m= uniq.shlib is not existing in $PWD/uniq.shlib or lib-path,\e[0m
71 \e[36m\e[1m= so include example.shlib with \e[35m\e[1muniq.shlib report errors\e[36m\e[1m.\e[0m
72 =================================
73 = 3.\e[45m\e[1mrelative-path inc.\e[0m
74 =================================
75 \e[36m\e[1m= some times, we put shlib file together with application program.\e[0m
76 \e[36m\e[1m= so, test relative path including.\e[0m
77 \e[36m\e[1m= delete example.shlib from shlib2.\e[0m
78 \e[36m\e[1m= try to include scripts/example.shlib based on PWD.\e[0m
79 load example.shlib at the beginning ...
80 load uniq.shlib at the beginning ...
81 PROG_GVAR_INIT uniq
82 uniqlib uniq
83 normal init invoke.
84 shlib_uniq_init() is invoked in uniq.shlib!
85 TEST_UNIQ defined in uniq.shlib is '1'.
86 TEST_INC_CNT defined in uniq.shlib is '1'.
87 TEST_INC_CNT is 1, it is exported by parent process.
88 load uniq.shlib at the tail ...
89 load example.shlib at the tail ...
90 \e[36m\e[1m= invoke function in example.shlib, and it would works.\e[0m
91 example_func() is invoked in example.shlib.
92 \e[36m\e[1m= invoke function in uniq.shlib, and it would works.\e[0m
93 uniq_test_func(TEST_UNIQ=1, TEST_INC_CNT=1) is invoked in uniq.shlib.
94 \e[36m\e[1m= unset function in example.shlib & uniq.shlib, and it would NOT works.\e[0m
95 ./1.file_inc_path_testing.sh: line 177: example_func: command not found
96 ./1.file_inc_path_testing.sh: line 178: uniq_test_func: command not found
97 =================================
98 = 4.\e[45m\e[1mrelative-path in nest inc.\e[0m
99 =================================
100 \e[36m\e[1m= some times, current path of file is not fixed if shlib is nestly included.\e[0m
101 \e[36m\e[1m= so, test relative path include in nest including.\e[0m
102 \e[36m\e[1m= example.shlib is included with relative path of 'scripts/example.shlib'.\e[0m
103 \e[36m\e[1m= uniq.shlib is included by example.shlib with \e[35m\e[1mrelative path of 'uniq.shlib'\e[36m\e[1m.\e[0m
104 \e[36m\e[1m= pay attension to the path of two files, it's the relative path of 'CURRENT FILE'.\e[0m
105 \e[36m\e[1m= NOT current program.\e[0m
106 =================================
107 \e[36m\e[1m= in the upper example, uniq.shlib is existing in $PWD/uniq.shlib,\e[0m
108 \e[36m\e[1m= so include example.shlib with \e[35m\e[1muniq.shlib does not report errors\e[36m\e[1m.\e[0m
109 =================================
110 = 5.\e[45m\e[1minc priority between pwd & lib path.\e[0m
111 =================================
112 \e[36m\e[1m= example2.shlib is copied to global \e[35m\e[1mshlib path\e[36m\e[1m as example3.shlib,\e[0m
113 \e[36m\e[1m= if there is a file example3.shlib in the \e[35m\e[1mrelative path\e[36m\e[1m,\e[0m
114 \e[36m\e[1m= which shlib will be \e[35m\e[1minclude as the defualt file\e[36m\e[1m?\e[0m
115 \e[36m\e[1m= copy example2.shlib to example3.shlib in global shlib path.\e[0m
116 scripts/example2.shlib => ~/.testing/shlib2/example3.shlib
117 \e[36m\e[1m= copy example.shlib to current path.\e[0m
118 scripts/example.shlib => ./example3.shlib
119 \e[36m\e[1m= try to invoke include example3.shlib.\e[0m
120 example2.shlib is included.
121 \e[36m\e[1m= invoke function in example.shlib, and it would works.\e[0m
122 example_func() is invoked in example2.shlib.
123 \e[36m\e[1m= look at the output string, it is the function in example2.shlib,\e[0m
124 \e[36m\e[1m= it means that files in global \e[35m\e[1mshlib path is used as default\e[36m\e[1m.\e[0m
125 =================================
126 \e[45m\e[1mend of include path testing.\e[0m
127 =================================